import { StrTool } from '@es-tool/core'

/**
 * 响应状态异常
 * @author LL
 * @date 2022-01-20 上午 10:32
 **/
export class ResponseStatusException<R> extends Error {
    public override name: string
    public override message: string
    /**
     * 携带响应对象
     * @type {R}
     */
    public data: R
    private readonly NAME = '响应状态错误'

    constructor(res: R, message: string = StrTool.EMPTY, name?: string) {
        super(message)
        this.data = res
        this.message = message
        this.name = name as string || this.NAME
    }
}
